package top.wuyang.trywork.controller;


import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import top.wuyang.trywork.base.PageBean;
import top.wuyang.trywork.base.R;
import top.wuyang.trywork.entity.TbSoftwareType;
import top.wuyang.trywork.service.TbSoftwareTypeService;
import top.wuyang.trywork.vo.PageVO;

@RestController
@RequestMapping("/softwareType")
@RequiredArgsConstructor
public class TbSoftwareTypeController {
    private final TbSoftwareTypeService tbSoftwareTypeService;

    @GetMapping("/{pn}/{ps}")
    public R<PageVO<TbSoftwareType>> query(@PathVariable("pn") Long pageNumber,@PathVariable("ps") Long pageSize, TbSoftwareType tbSoftwareType){
        return tbSoftwareTypeService.queryPage(PageBean.instance(pageNumber,pageSize),tbSoftwareType);
    }

    @GetMapping("/{id}")
    public R<TbSoftwareType> queryById(@PathVariable("id") Integer id){
        return tbSoftwareTypeService.queryById(id);
    }

    @PostMapping("")
    public R<String> insert(@RequestBody TbSoftwareType tbSoftwareType){
        return tbSoftwareTypeService.insert(tbSoftwareType);
    }

    @PutMapping("")
    public R<String> update(@RequestBody TbSoftwareType tbSoftwareType){
        return tbSoftwareTypeService.update(tbSoftwareType);
    }

    @DeleteMapping("/{id}")
    public R<String> delete(@PathVariable("id") Integer id){
        return tbSoftwareTypeService.delete(id);
    }



}
